<?php
namespace Core\lib;
use Core\BeanFactory;
use Core\init\MyDB;
use Illuminate\Database\Eloquent\Model;

class DBModel extends Model{

    public static function __callStatic($method, $parameters)
    {
        $mydb=clone BeanFactory::getBean(MyDB::class);
        $obj=$mydb->genConnection();
        try{
            $ret=parent::__callStatic($method, $parameters);
            return $ret;
        }catch (\Exception $exception){
            var_dump($exception);
            return null;
        }finally{
            $mydb->releaseConnection($obj);
        }

    }

}